package cn.smile.controller.core;

import cn.smile.bean.dto.core.FileViewDTO;
import cn.smile.bean.form.core.swiper.SaveSwiperForm;
import cn.smile.business.core.ISwiperUserService;
import cn.smile.commons.response.MyResult;
import org.springframework.web.bind.annotation.*;

import jakarta.annotation.Resource;

import java.util.List;

@RestController
@RequestMapping("api/swiper")
public class SwiperController {

    @Resource
    private ISwiperUserService service;

    @GetMapping(value = "getSwiperList")
    public MyResult<List<String>> getSwiperList() {
        return MyResult.OK(service.getSwiperUrlList());
    }

    @GetMapping(value = "getSwiperDetailList")
    public MyResult<List<FileViewDTO>> getSwiperDetailList() {
        return MyResult.OK(service.getSwiperDetailList());
    }

    @PostMapping(value = "saveSwiper")
    public MyResult<Boolean> saveSwiper(@RequestBody SaveSwiperForm form) {
        return MyResult.OK(service.saveSwiper(form));
    }
}
